home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_force_saberthrow.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
6KB
|
232 lines
# Jedi Knight Cog Script
#
# FORCE_SABERTHROW.COG
#
# FORCEPOWER Script - Saber Throw
# Bin 37
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing player local
flex cost=60.0 local
int rank=0 local
flex mana local
sound saberSound=SaberThrow.wav local
int saber local
int saberIndex local
template lightsaber=+force_saber local
template blueSaber=+fsab_blue local
template greenSaber=+fsab_green local
template yellowSaber=+fsab_yellow local
template orangeSaber=+fsab_orange local
template redSaber=+fsab_red local
template dredSaber=+fsab_dred local
template purpleSaber=+fsab_purple local
int saberSideMat=-1 local
material blueMat=saberblue1.mat local
material greenMat=sabergreen1.mat local
material yellowMat=saberyellow1.mat local
material orangeMat=saberorange1.mat local
material redMat=saberred1.mat local
material dredMat=saberdred1.mat local
material purpleMat=saberpurple1.mat local
flex autoAimFOV=10 local
int inbubble=0 local
message startup
message shutdown
message activated
message timer
message newplayer
message killed
message selected
message enterbubble
message exitbubble
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
inbubble = 0;
call stop_power;
Return;
# ........................................................................................
shutdown:
call stop_power;
Return;
# ........................................................................................
activated:
if(inbubble) Return;
// saber is not the current weapon
if(GetCurWeapon(player) != 11) Return;
// the saber is being drawn right now
if(SetInv(player, 89) == 1) Return;
rank = GetInv(player, 37);
if(rank == 1) cost = 100;
else if(rank == 2) cost = 80;
else if(rank == 3) cost = 60;
else if(rank == 4) cost = 40;
if(GetInv(player, 14) < cost && GetInv(player, 14) < GetInv(player, 69)) Return;
if(!IsInvActivated(player, 37))
{
SetInvActivated(player, 37, 1);
SetInv(player, 131, 0);
SetFireWait(player, -1);
SetMountWait(player, 0);
SetCurInvWeapon(player, 0);
SelectWeapon(player, 1);
// Cleanup in the saber cog because we tried very hard
// NOT to call its deselected: event just above to avoid
// playing the dismount animation, etc.
SendMessage(GetInvCog(player, 131), user0);
//PlayMode(player, 24);
if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
// Send a "force disturbance"...
if(!IsMulti())
SendMessageExRadius(GetThingPos(player), cost, 0x4, splash, 37, 0, 0, 0);
saberSideMat = jkGetSaberSideMat(player);
if(saberSideMat == blueMat)
{
// Print("Blue saber...");
saberIndex = 1;
}
else
if(saberSideMat == greenMat)
{
// Print("Green saber...");
saberIndex = 2;
}
else
if(saberSideMat == yellowMat)
{
// Print("Yellow saber...");
saberIndex = 3;
}
else
if(saberSideMat == orangeMat)
{
// Print("Orange saber...");
saberIndex = 4;
}
else
if(saberSideMat == redMat)
{
// Print("Red saber...");
saberIndex = 5;
}
else
if(saberSideMat == dredMat)
{
// Print("Dark Red saber...");
saberIndex = 6;
}
else
if(saberSideMat == purpleMat)
{
// Print("Purple saber...");
saberIndex = 7;
}
else
{
// Print("Unknown saber... Throwing yellow saber...");
saberIndex = 3;
}
FireProjectile(player, lightsaber[saberIndex], saberSound, 24, '0 0 0', '0 0 0', 1.0, 0, autoAimFOV, autoAimFOV);
// We really don't want to lose the saber in single player...
// Or if the personnality is Jedi...
if((jkGetMultiParam(0) == 0) || (jkGetMultiParam(0) == 1))
SetTimerEx(5, 1, 0, 0);
else
SetTimerEx(5, 2, 0, 0);
SetBinWait(player, 37, 5.5);
}
Return;
# ........................................................................................
timer:
if(GetSenderId() == 1) SetInv(player, 131, 1);
call stop_power;
Return;
# ........................................................................................
selected:
jkPrintUNIString(player, 37);
Return;
# ........................................................................................
killed:
if(GetSenderRef() != player) Return;
newplayer:
call stop_power;
Return;
# ........................................................................................
enterbubble:
inbubble = 1;
call stop_power;
Return;
# ........................................................................................
exitbubble:
inbubble = 0;
Return;
# ........................................................................................
stop_power:
SetInvActivated(player, 37, 0);
Return;
end